import { Controller, Get } from '@nestjs/common';
import { UserService } from './user.service';
import Redis from 'ioredis';
import { InjectRedis } from '~/common/decorators/inject-redis.decorator';
import { definePermission, Perm } from '../auth/decorators/permission.decorator';
export const permissions = definePermission('system:user', {
  LIST: 'list',
  CREATE: 'create',
  READ: 'read',
  UPDATE: 'update',
  DELETE: 'delete',
  PASSWORD_UPDATE: 'password:update',
  PASSWORD_RESET: 'pass:reset'
} as const);
@Controller('user')
export class UserController {
  constructor(
    @InjectRedis() private redis: Redis,
    private userService: UserService
  ) {}
  @Get()
  @Perm(permissions.LIST)
  findAll() {
    return this.userService.list();
  }
}
